layui.use(['form'], function () {
    var form = layui.form;
    var layer = layui.layer;
    //提交事件
    form.on('submit(submit)', function (data) {
        console.log()
        //
        let MyUrl='',myData=data.field
        myData.status=typeof data.field.status !='undefined' && data.field.status=='on'?1:0
        if('add'==$('#type').val()){
            MyUrl='/jzweb/jazProdType/saveProdType'
        }else{
            MyUrl='/jzweb/jazProdType/update'
            myData.id=$('#dataId').val()
        }


        AjaxPost(MyUrl, myData).then(function (response) {
            parent.layer.msg("操作成功");
            var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
            parent.layer.close(index);
            parent.load();
        }).catch(error => {
            layer.msg(error.msg)
        })

        return false;
    });


});